﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using FarseerGames.FarseerPhysics.Factories;
using Microsoft.Xna.Framework;

namespace SimpleGame
{
    class Ball:Sprite
    {
        float speed;

        public float Speed
        {
            get { return speed; }
            set { speed = value; }
        }

        public Ball()
            : base()
        {
            speed = 1000.0f;
        }

        public override bool Load(string assetName, Microsoft.Xna.Framework.Content.ContentManager content, FarseerGames.FarseerPhysics.PhysicsSimulator simulator)
        {
            currentTexture = content.Load<Texture2D>(assetName);
            origin = new Vector2(currentTexture.Width / 2, currentTexture.Height / 2);
            body = BodyFactory.Instance.CreateCircleBody(CurrentTexture.Width / 2, 1.0f);
            geom = GeomFactory.Instance.CreateCircleGeom(body, CurrentTexture.Width / 2, 40);
            //body = BodyFactory.Instance.CreateRectangleBody(currentTexture.Height, currentTexture.Width, 1);
            //geom = GeomFactory.Instance.CreateRectangleGeom(body, currentTexture.Width, currentTexture.Height);
            body.Position = position;
            body.Tag = this;
            geom.Tag = this;
            simulator.Add(body);
            simulator.Add(geom);
            return true;
        }

    }
}
